package com.art.sunflower.mapper;

import com.art.sunflower.pojo.SchoolTeacher;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface SchoolTeacherMapper {
    @Insert("insert into school_teacher(name,information,url,is_index) values(#{name},#{information}," +
            "#{url},false)")
    int insert(SchoolTeacher schoolTeacher);

    @Update("update school_teacher set name=#{name},information=#{information},url=#{url} where id = #{id}")
    int update(SchoolTeacher schoolTeacher);

    @Update("update school_teacher set is_index=#{isIndex} where id = #{id}")
    int updateIndex(int id, boolean isIndex);

    @Delete("delete from school_teacher where id = #{id}")
    int delete(int id);

    @Select("select * from school_teacher where id=#{id}")
    SchoolTeacher selectOne(int id);

    @Select("select * from school_teacher")
    List<Map<String, Object>> listAll();

}
